package org.lgiavedoni.android.franq.util.weka;

import java.util.ArrayList;
import java.util.List;

import org.lgiavedoni.android.franq.core.envent.Event;
import org.lgiavedoni.android.franq.core.envent.dao.EventDao;

@Deprecated
public class ArffUtil {

	private static String generateHead(List<Event> events) {
		StringBuffer head = new StringBuffer();
		head.append("@relation eventos\n");

		head.append("@attribute dia {1, 2, 3, 4, 5, 6, 7} \n");
		head.append("@attribute hora {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24} \n");
		head.append("@attribute evento{");
		List<String> keys = new ArrayList<String>();
		for (Event e : events) {
			// if (!keys.contains(e.getEventArffKey()))
			// keys.add(e.getEventArffKey());
		}
		for (int i = 0; i < keys.size(); i++) {
			head.append(" '" + keys.get(i) + "'");
			if (i + 1 < keys.size())
				head.append(",");
		}
		head.append("}");

		return head.toString();
	}

	public static String generateArffFile(List<Event> events) {
		StringBuffer arff = new StringBuffer();
		arff.append(generateHead(events));
		arff.append("\n");
		arff.append("@data \n");
		for (Event e : events) {
			// arff.append(e.generateArffLine() + "\n");
		}
		return arff.toString();
	}

	public static void main(String a[]) {
		System.out.println(generateArffFile(EventDao.inst.getAll()));
	}

}
